//JavaScript Framework 2.0 Code
try{
Type.registerNamespace('com.yonyou.ncmm_pac_pda.ConnectTestController');
com.yonyou.ncmm_pac_pda.ConnectTestController = function() {
    com.yonyou.ncmm_pac_pda.ConnectTestController.initializeBase(this);
    this.initialize();
}
function com$yonyou$ncmm_pac_pda$ConnectTestController$initialize(){
    var host = $cache.read("host") ? $cache.read("host") : "";
    var port = $cache.read("port") ? $cache.read("port") : "";
    
    var settinginfo = {"host":host,"port":port};
	
    $ctx.push(settinginfo);
}
    
function com$yonyou$ncmm_pac_pda$ConnectTestController$evaljs(js){
    eval(js)
}

function com$yonyou$ncmm_pac_pda$ConnectTestController$btnback_onclick(sender, args){
	$view.close();
}
function com$yonyou$ncmm_pac_pda$ConnectTestController$btntestconn_onclick(sender, args){
	var host = $id("txthost").get("value");
	var port = $id("txtport").get("value");
	
	if (!host || !port) {
		$toast("请先设置服务器信息");
		return;
	}
	var url = 'http://' + host + ':' + port + '/service/exbdlogin';
	$js.showLoadingBar();
	$service.call('MMHttpService.post', {
		'url' : url,
		'data' : {nccontext:{user:"1", password:"1", exsystemcode:'mmapp', devicecode:'pda001'}},
		'callback' : 'testCallBack()',
		'header' : {
			'Content-Type' : 'application/json'
		}
	},true);
}



com.yonyou.ncmm_pac_pda.ConnectTestController.prototype = {
    btntestconn_onclick : com$yonyou$ncmm_pac_pda$ConnectTestController$btntestconn_onclick,
    btnback_onclick : com$yonyou$ncmm_pac_pda$ConnectTestController$btnback_onclick,
    initialize : com$yonyou$ncmm_pac_pda$ConnectTestController$initialize,
    evaljs : com$yonyou$ncmm_pac_pda$ConnectTestController$evaljs
};
com.yonyou.ncmm_pac_pda.ConnectTestController.registerClass('com.yonyou.ncmm_pac_pda.ConnectTestController',UMP.UI.Mvc.Controller);
}catch(e){$e(e);}

function testCallBack(){
	$js.hideLoadingBar();
	var result = $ctx.param("result");
	if (!result || result == "") {
		$toast("测试未通过");
		return;
	}
	
	$toast("测试通过");
}
